<!doctype html><html lang=en dir=auto>
<head><meta charset=utf-8>
<meta http-equiv=x-ua-compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name=robots content="index, follow">
<title>Blogs | wenbin</title>
<meta name=keywords content>
<meta name=description content="Blogs - wenbin">
<meta name=author content>
<link rel=canonical href=https://imwenbin.com/blog/>
<link crossorigin=anonymous href=/assets/css/stylesheet.min.css rel="preload stylesheet" as=style>
<link rel=icon href=https://imwenbin.com/favicon.ico>
<link rel=icon type=image/png sizes=16x16 href=https://imwenbin.com/favicon16x16.png>
<link rel=icon type=image/png sizes=32x32 href=https://imwenbin.com/favicon32x32.png>
<link rel=apple-touch-icon href=https://imwenbin.com/apple_touch_icon.png>
<link rel=mask-icon href=https://imwenbin.com/safari_pinned_tab.svg>
<meta name=theme-color content="#2e2e33">
<meta name=msapplication-TileColor content="#2e2e33">
<meta name=generator content="Hugo 0.89.3">
<link rel=alternate type=application/rss+xml href=https://imwenbin.com/blog/index.xml>
<noscript>
<style>#theme-toggle,.top-link{display:none}</style>
<style>@media(prefers-color-scheme:dark){:root{--theme:rgb(29, 30, 32);--entry:rgb(46, 46, 51);--primary:rgb(218, 218, 219);--secondary:rgb(155, 156, 157);--tertiary:rgb(65, 66, 68);--content:rgb(196, 196, 197);--hljs-bg:rgb(46, 46, 51);--code-bg:rgb(55, 56, 62);--border:rgb(51, 51, 51)}.list{background:var(--theme)}.list:not(.dark)::-webkit-scrollbar-track{background:0 0}.list:not(.dark)::-webkit-scrollbar-thumb{border-color:var(--theme)}}</style>
</noscript><meta property="og:title" content="Blogs">
<meta property="og:description" content>
<meta property="og:type" content="website">
<meta property="og:url" content="https://imwenbin.com/blog/"><meta property="og:site_name" content="wenbin">
<meta name=twitter:card content="summary">
<meta name=twitter:title content="Blogs">
<meta name=twitter:description content>
<script type=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Blogs","item":"https://imwenbin.com/blog/"}]}</script>
</head>
<body class=list id=top>
<script>localStorage.getItem("pref-theme")==="dark"?document.body.classList.add('dark'):localStorage.getItem("pref-theme")==="light"?document.body.classList.remove('dark'):window.matchMedia('(prefers-color-scheme: dark)').matches&&document.body.classList.add('dark')</script>
<header class=header>
<nav class=nav>
<div class=logo>
<a href=https://imwenbin.com/ accesskey=h title="wenbin (Alt + H)">wenbin</a>
<span class=logo-switches>
<button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>
</button>
</span>
</div>
<ul id=menu>
<li>
<a href=https://imwenbin.com/blog/ title=Blog>
<span class=active>Blog</span>
</a>
</li>
<li>
<a href=https://imwenbin.com/archives title=Archive>
<span>Archive</span>
</a>
</li>
<li>
<a href=https://imwenbin.com/tags title=Tags>
<span>Tags</span>
</a>
</li>
</ul>
</nav>
</header>
<main class=main>
<header class=page-header><div class=breadcrumbs><a href=https://imwenbin.com/>Home</a></div>
<h1>Blogs</h1>
</header>
<article class=post-entry>
<header class=entry-header>
<h2>NSData NSString base64互相转换
</h2>
</header>
<section class=entry-content>
<p>// 普通string NSString *string = @"hello"; // 普通string -> 普通data NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; // 普通data -> 普通string NSString *string_2 = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; // 普通data -> base64data NSData *base64data = [data base64EncodedDataWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; // 普通data -> base64string NSString *base64string = [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; // base64data -> 普通data NSData *data_2 = [[NSData alloc] initWithBase64EncodedData:base64data options:NSDataBase64DecodingIgnoreUnknownCharacters]; // base64string -> 普通data NSData *data_3 = [[NSData alloc] initWithBase64EncodedString:base64string options:NSDataBase64DecodingIgnoreUnknownCharacters]; NSDataBase64EncodingOptions 选项：...</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:49:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to NSData NSString base64互相转换" href=https://imwenbin.com/blog/nsdata-nsstring-base64%E4%BA%92%E7%9B%B8%E8%BD%AC%E6%8D%A2/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>Vim 基础操作（二）
</h2>
</header>
<section class=entry-content>
<p>[这是上一篇 Vim 基础操作文章](/Blog/Vim 基础操作（一）.md)
文本编辑 上一遍简洁说了 Vim 有两种模式，普通模式和输入模式，现在重点说文本编辑，以下命令都在 普通模式 下使用
i：立即在当前位置进入输入模式 o：立即在下一行进入输入模式 O：立即在上一行进入输入模式 I：在行头进行编辑 A：在行尾进行编辑 复制 剪切 粘贴 撤销 yy：复制当前行 dd：删除当前行并复制 p：粘贴复制的内容 u：撤销上一步操作
文本对象操作 diw：删除一个单词 ca"：删除包括双引号在内的文本，并进入编辑模式 yi"：复制双引号内的文本，不包括双引号
总结 Vim 有很多命令，两篇文章只列出了一些常用命令，从小白进入 Vim 的世界。 Vim 还有很多神级插件提高效率，让我们以后继续学习吧。</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:46:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to Vim 基础操作（二）" href=https://imwenbin.com/blog/vim-%E5%9F%BA%E7%A1%80%E6%93%8D%E4%BD%9C%E4%BA%8C/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>Vim 基础操作（一）
</h2>
</header>
<section class=entry-content>
<p>命令默认都在 Mac 自带终端使用
基础操作 使用 Vim 打开一个文件 cd 文件路径 vim 文件名 进入普通模式 输入模式 在普通模式下按 i 进入输入模式
退出 在输入模式下按 Esc 进入普通模式，接着可以输入命令： :q 直接退出 :q! 退出并丢弃修改 :x 保存并退出
光标移动 方向键 h l j k 四个键 h : 向左移动一个字符 l ：向右移动一个字符 j ：向下移动一行 k：向上移动一行 重复移动 在四个键前加个数字，例如：
10h：向左移动10个字符 7k：向上移动7个字符 单词移动 Option 键 w b e ge w：移动到下一个单词首 b：移动到上一个单词首 e：移动到下一个单词尾 ge：移动到上一个单词尾 行移动 在普通模式下移动...</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:45:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to Vim 基础操作（一）" href=https://imwenbin.com/blog/vim-%E5%9F%BA%E7%A1%80%E6%93%8D%E4%BD%9C%E4%B8%80/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>Macbook Pro touch bar 设置小tips
</h2>
</header>
<section class=entry-content>
<p> touch bar 的出现让人又爱又恨，根据切换的软件可以自行改变，但是有时需要用到Fn键和传统控制区就让人头大，此文教大家简单设置touch bar的状态，根据自己的需要设置
touch bar支持的设置 应用控制 根据切换的应用来回变换，选择后支持关闭功能栏
展开的功能栏 传统的功能区，只是变成了触控形式，固定显示，不会根据应用切换
F1、F2 等键 排列会从esc F1 … F12
快速操作 个人感觉没啥用，感兴趣的可以试试
选择完对应的选项后，下方可以继续选择按下Fn键显示什么 </p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:44:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to Macbook Pro touch bar 设置小tips" href=https://imwenbin.com/blog/macbook-pro-touch-bar-%E8%AE%BE%E7%BD%AE%E5%B0%8Ftips/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>Swift5 访问限制关键字
</h2>
</header>
<section class=entry-content>
<p>访问控制关键字 限制从高到低排列
private fileprivate internal public open 简单总结： private 只能在当前文件的当前模块的作用域使用 fileprivate 只能在当前文件内使用 internal 是默认访问级别，所有没有单独列出的都是这个权限 public 可以在外部文件访问，如果只需要访问就用它 open 可以在外部文件访问，如果需要继承和重写就用它
更多详细区别： https://swiftgg.gitbook.io/swift/swift-jiao-cheng/25_access_control</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:43:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to Swift5 访问限制关键字" href=https://imwenbin.com/blog/swift5-%E8%AE%BF%E9%97%AE%E9%99%90%E5%88%B6%E5%85%B3%E9%94%AE%E5%AD%97/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>CocoaPods版本升级
</h2>
</header>
<section class=entry-content>
<p> 查看当前 Cocoapods版本 pod --version
检查当前 ruby 源，使用 gems.ruby-china.com 源 gem source -l gem sources --remove 旧源 gem sources -a 新源
更新Cocoapods sudo gem install cocoapods 回车然后输入电脑密码
再次检查当前Cocoapods版本 pod --version
完成
</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:42:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to CocoaPods版本升级" href=https://imwenbin.com/blog/cocoapods%E7%89%88%E6%9C%AC%E5%8D%87%E7%BA%A7/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>多人开发git提交流程
</h2>
</header>
<section class=entry-content>
<p> 本文以master和dev举例，可视化git工具为sourceTree
在 dev 开发完成后提交到本地，不推送到远程 切换到 master 拉去远程分支代码 show in finder 打开项目运行，没有问题后切换到 dev 分支 将 master 分支合并到 dev ，运行代码 没有冲突：运行step5
有冲突
两人操作同一份类文件冲突： 定位到冲突文件，调整类文件代码顺序，清除冲突标记 在 sourceTree 中右键选择冲突文件，选择 解决冲突 提交后确认代码确认没有问题 工程文件冲突： 直接在 sourceTree 中选择冲突文件，选择 采用他人版本 show in finder 找回因采用他人版本自己本地被移除的本地文件 提价后运行代码，确保自己后面修改的文件都在，运行没有问题 解决完冲突提交后，跳回 master 分支，合并 dev 到 master 再次在 master 分支中运行项目，确保没有问题 提交并推送到远程 master 分支 跳转到 dev 分支继续开发 </p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:41:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to 多人开发git提交流程" href=https://imwenbin.com/blog/%E5%A4%9A%E4%BA%BA%E5%BC%80%E5%8F%91git%E6%8F%90%E4%BA%A4%E6%B5%81%E7%A8%8B/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>iOS 推送报错BadCertificateEnvironment
</h2>
</header>
<section class=entry-content>
<p>报 BadCertificateEnvironment 错一般来说是环境和证书不匹配，但是如果环境和证书确认没问题还报错，解决如下：
进钥匙串导出开发环境和发布环境的p12证书
❗️❗️❗️❗️❗️ 开发环境从私钥导出，发布环境从外层导出（千万别从私钥导出，否则会一直报这个错）
如图</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:40:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to iOS 推送报错BadCertificateEnvironment" href=https://imwenbin.com/blog/ios-%E6%8E%A8%E9%80%81%E6%8A%A5%E9%94%99badcertificateenvironment/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>判断机型，支持最新设备（iPhone SE Gen2 和 iPad Pro 11 Gen2、iPad Pro 12.9 Gen4）
</h2>
</header>
<section class=entry-content>
<p>2020-7-10 更新 ⚠️已停止维护
现已支持CocoaPods
只涉及最新的iPhone和iPad设备
Github
// 导入这个框架 #import &lt;sys/utsname.h> + (NSString *)getDeviceName { struct utsname systemInfo; uname(&systemInfo); NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; #pragma mark iPhone if ([deviceModel isEqualToString:@"iPhone1,1"]) return @"iPhone 1G"; if ([deviceModel isEqualToString:@"iPhone1,2"] || [deviceModel isEqualToString:@"iPhone1,2*"]) return @"iPhone 3G"; if ([deviceModel isEqualToString:@"iPhone2,1"] || [deviceModel isEqualToString:@"iPhone2,1*"]) return @"iPhone 3GS"; if ([deviceModel isEqualToString:@"iPhone3,1"] || [deviceModel isEqualToString:@"iPhone3,2"] || [deviceModel isEqualToString:@"iPhone3,3"]) return @"iPhone 4"; if ([deviceModel isEqualToString:@"iPhone4,1"] || [deviceModel isEqualToString:@"iPhone4,1*"]) return @"iPhone 4S"; if ([deviceModel isEqualToString:@"iPhone5,1"] || [deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5"; if ([deviceModel isEqualToString:@"iPhone5,3"] || [deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5C"; if ([deviceModel isEqualToString:@"iPhone6,1"] || [deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5S"; if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6"; if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus"; if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s"; if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus"; if ([deviceModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE"; if ([deviceModel isEqualToString:@"iPhone9,1"] || [deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7"; if ([deviceModel isEqualToString:@"iPhone9,2"] || [deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus"; if ([deviceModel isEqualToString:@"iPhone10,1"] || [deviceModel isEqualToString:@"iPhone10,4"]) return @"iPhone 8"; if ([deviceModel isEqualToString:@"iPhone10,2"] || [deviceModel isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus"; if ([deviceModel isEqualToString:@"iPhone10,3"] || [deviceModel isEqualToString:@"iPhone10,6"]) return @"iPhone X"; if ([deviceModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS"; if ([deviceModel isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max"; if ([deviceModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR"; if ([deviceModel isEqualToString:@"iPhone12,1"]) return @"iPhone 11"; if ([deviceModel isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro"; if ([deviceModel isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max"; if ([deviceModel isEqualToString:@"iPhone12,8"]) return @"iPhone SE Gen2"; #pragma mark iPad if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad 1"; if ([deviceModel isEqualToString:@"iPad2,1"] || [deviceModel isEqualToString:@"iPad2,2"] || [deviceModel isEqualToString:@"iPad2,3"] || [deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2"; if ([deviceModel isEqualToString:@"iPad3,1"] || [deviceModel isEqualToString:@"iPad3,2"] || [deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3"; if ([deviceModel isEqualToString:@"iPad3,4"] || [deviceModel isEqualToString:@"iPad3,5"] || [deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4"; if ([deviceModel isEqualToString:@"iPad2,5"] || [deviceModel isEqualToString:@"iPad2,6"] || [deviceModel isEqualToString:@"iPad2,7"]) return @"iPad mini"; if ([deviceModel isEqualToString:@"iPad4,1"] || [deviceModel isEqualToString:@"iPad4,2"] || [deviceModel isEqualToString:@"iPad4,3"]) return @"iPad Air"; if ([deviceModel isEqualToString:@"iPad4,4"] || [deviceModel isEqualToString:@"iPad4,5"] || [deviceModel isEqualToString:@"iPad4,6"]) return @"iPad mini 2"; if ([deviceModel isEqualToString:@"iPad5,3"] || [deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2"; if ([deviceModel isEqualToString:@"iPad4,7"] || [deviceModel isEqualToString:@"iPad4,8"] || [deviceModel isEqualToString:@"iPad4,9"]) return @"iPad mini 3"; if ([deviceModel isEqualToString:@"iPad5,1"] || [deviceModel isEqualToString:@"iPad5,2"]) return @"iPad mini 4"; if ([deviceModel isEqualToString:@"iPad6,7"] || [deviceModel isEqualToString:@"iPad6,8"]) return @"iPad PRO 12....</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:39:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to 判断机型，支持最新设备（iPhone SE Gen2 和 iPad Pro 11 Gen2、iPad Pro 12.9 Gen4）" href=https://imwenbin.com/blog/%E5%88%A4%E6%96%AD%E6%9C%BA%E5%9E%8B%E6%94%AF%E6%8C%81%E6%9C%80%E6%96%B0%E8%AE%BE%E5%A4%87iphone-se-gen2-%E5%92%8C-ipad-pro-11-gen2ipad-pro-12.9-gen4/></a>
</article>
<article class=post-entry>
<header class=entry-header>
<h2>Xcode打包每次输入用户名和密码
</h2>
</header>
<section class=entry-content>
<p>步骤 钥匙串 - 对应的证书秘钥 双击 - 访问控制 - 选择第一个 - 输入密码 完成 </p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:38:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to Xcode打包每次输入用户名和密码" href=https://imwenbin.com/blog/xcode%E6%89%93%E5%8C%85%E6%AF%8F%E6%AC%A1%E8%BE%93%E5%85%A5%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81/></a>
</article>
<footer class=page-footer>
<nav class=pagination>
<a class=prev href=https://imwenbin.com/blog/page/4/>« Prev Page</a>
<a class=next href=https://imwenbin.com/blog/page/6/>Next Page »</a>
</nav>
</footer>
</main>
<footer class=footer>
<span>&copy; 2021 <a href=https://imwenbin.com/>wenbin</a>.</span>
<span>
保留部分权利。
</span>
</footer>
<a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg>
</a>
<script>let menu=document.getElementById('menu');menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(a=>{a.addEventListener("click",function(b){b.preventDefault();var a=this.getAttribute("href").substr(1);window.matchMedia('(prefers-reduced-motion: reduce)').matches?document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView({behavior:"smooth"}),a==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${a}`)})})</script>
<script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script>
<script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove('dark'),localStorage.setItem("pref-theme",'light')):(document.body.classList.add('dark'),localStorage.setItem("pref-theme",'dark'))})</script>
</body>
</html>